﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBatisNet.DataMapper;
using Tasks.Common.Entitys;
using System.Collections;

namespace Tasks.Dao
{
    /// <summary><c>NoticeDao</c> is the implementation of <see cref="INoticeDao"/>.</summary>
    public partial class NoticeDao : Mapper
    {

        /// <summary>Implements <see cref="INoticeDao.GetCount"/></summary>
        public int GetCount(Int32 OwnerID)
        {
            Hashtable ht = new Hashtable();
            ht["OwnerID"]=OwnerID;
            String stmtId = "Notice.GetCount";
            int result = ExecuteQueryForObject<int>(stmtId,ht);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.Find"/></summary>
        public Notice Find(Int32 NoticeID)
        {
            String stmtId = "Notice.Find";
            Notice result = ExecuteQueryForObject<Notice>(stmtId, NoticeID);
            return result;
        }
        public IList<Notice> FindAll()
        {
            String stmtId = "Notice.FindAll";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, null);
            return result;
        }
        /// <summary>Implements <see cref="INoticeDao.Search"/></summary>
        public IList<Notice> Search( Hashtable ht, int pageSize, int PageIndex, out int rowCount)
        {
            ht.Add("PageSize", pageSize);
            ht.Add("PageIndex", PageIndex);
            rowCount = ExecuteQueryForObject<int>("Notice.SearchCount", ht);
            if (rowCount == 0)
                return null;
            else
                return ExecuteQueryForList<Notice>("Notice.Search", ht);
        }
       
        /// <summary>Implements <see cref="INoticeDao.QuickFindAll"/></summary>
        public IList<Notice> QuickFindAll()
        {
            String stmtId = "Notice.QuickFindAll";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, null);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByMode"/></summary>
        public IList<Notice> FindByMode(Int32 NoticeMode)
        {
            String stmtId = "Notice.FindByMode";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, NoticeMode);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByUrl"/></summary>
        public IList<Notice> FindByUrl(String NoticeUrl)
        {
            String stmtId = "Notice.FindByUrl";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, NoticeUrl);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByMobile"/></summary>
        public IList<Notice> FindByMobile(Int32 NoticeMobile)
        {
            String stmtId = "Notice.FindByMobile";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, NoticeMobile);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByContent"/></summary>
        public IList<Notice> FindByContent(String NoticeContent)
        {
            String stmtId = "Notice.FindByContent";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, NoticeContent);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByDate"/></summary>
        public IList<Notice> FindByDate(DateTime Noticedate)
        {
            String stmtId = "Notice.FindByDate";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, Noticedate);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.FindByState"/></summary>
        public IList<Notice> FindByState(Int32 NoticeState)
        {
            String stmtId = "Notice.FindByState";
            IList<Notice> result = ExecuteQueryForList<Notice>(stmtId, NoticeState);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.Insert"/></summary>
        public void Insert(Notice obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "Notice.Insert";
            ExecuteInsert(stmtId, obj);
        }

        /// <summary>Implements <see cref="INoticeDao.Update"/></summary>
        public void Update(Notice obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "Notice.Update";
            ExecuteUpdate(stmtId, obj);
        }

        /// <summary>Implements <see cref="INoticeDao.Delete"/></summary>
        public void Delete(Notice obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "Notice.Delete";
            ExecuteDelete(stmtId, obj);
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByMode"/></summary>
        public int DeleteByMode(Int32 NoticeMode)
        {
            String stmtId = "Notice.DeleteByMode";
            int result = ExecuteDelete(stmtId, NoticeMode);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByUrl"/></summary>
        public int DeleteByUrl(String NoticeUrl)
        {
            String stmtId = "Notice.DeleteByUrl";
            int result = ExecuteDelete(stmtId, NoticeUrl);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByMobile"/></summary>
        public int DeleteByMobile(String NoticeMobile)
        {
            String stmtId = "Notice.DeleteByMobile";
            int result = ExecuteDelete(stmtId, NoticeMobile);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByContent"/></summary>
        public int DeleteByContent(String NoticeContent)
        {
            String stmtId = "Notice.DeleteByContent";
            int result = ExecuteDelete(stmtId, NoticeContent);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByDate"/></summary>
        public int DeleteByDate(DateTime Noticedate)
        {
            String stmtId = "Notice.DeleteByDate";
            int result = ExecuteDelete(stmtId, Noticedate);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.DeleteByState"/></summary>
        public int DeleteByState(Int32 NoticeState)
        {
            String stmtId = "Notice.DeleteByState";
            int result = ExecuteDelete(stmtId, NoticeState);
            return result;
        }

        /// <summary>Implements <see cref="INoticeDao.Reload"/></summary>
        public void Reload(Notice obj)
        {
            if (obj == null) throw new ArgumentNullException("obj");
            String stmtId = "Notice.Find";
            ExecuteQueryForObject<Notice>(stmtId, obj);
        }

    }
}
